package com.fhMall.request;

import com.fhMall.request.vo.WechatOrderItemVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 微信下单实体
 * @author： qiujunda
 * @date： 2019/10/9 22:35
 */
@Data
@ApiModel("提交订单Request")
@Builder(builderClassName = "Builder")
@AllArgsConstructor
@NoArgsConstructor
public class SubmitOrderRequest {

    @ApiModelProperty("优惠券ID")
    private Integer couponId;

    @ApiModelProperty("优惠券抵扣金额")
    private BigDecimal couponPrice;

    @ApiModelProperty("用户帐号")
    private Integer memberId;

    @ApiModelProperty("订单总金额")
    private BigDecimal totalPrice;

    @ApiModelProperty("应付金额（实际支付金额）")
    private BigDecimal payPrice;

    @ApiModelProperty("下单时使用的积分")
    private Integer useIntegration;

    @ApiModelProperty("运费金额")
    private BigDecimal freightPrice;

    @ApiModelProperty("收货地址id")
    private Integer memberReceiveAddress;

    @ApiModelProperty("订单备注")
    private String note;

    @ApiModelProperty("微信支付订单号")
    private String wechatPrepayId;

    @ApiModelProperty("订单商品行信息")
    private List<WechatOrderItemVo> orderItem=new ArrayList<>();

    public String getShoppingCarIds(){
        String ids="";
        for(WechatOrderItemVo wechatOrderItemVo:orderItem){
            Integer shoppingCarId=wechatOrderItemVo.getShoppingCarId();
            if(shoppingCarId!=null){
                ids+=(shoppingCarId+",");
            }
        }
        return ids;
    }
}
